#include <stdio.h>
//#include <windows.h>

typedef struct member
{
    int id;
    struct member *next;
};

int main()
{
    int m, n, k, m2, v;
    int i;
    struct member *master;
    struct member *nextstu;
    struct member *laststu;
    struct member *oldstu;
    master = (struct member *)malloc(sizeof(struct member));
    master->next = master;
    master->id = 1;
    laststu = master;

    //k series
    struct member *master2;
    struct member *nextstu2;
    struct member *laststu2;
    struct member *oldstu2;
    master2 = (struct member *)malloc(sizeof(struct member));
    master2->next = master2;
    laststu2 = master2;

    scanf("%d %d %d", &m, &n, &k);
    m2 = m;
    for (i = 2; i <= m; i++)
    {
        nextstu = (struct member *)malloc(sizeof(struct member));
        nextstu->id = i;
        laststu->next = nextstu;
        nextstu->next = master;
        if (i != m)
        {
            laststu = laststu->next;
        }
    }
    oldstu = laststu;
    v = 1;
    while (m != 0)
    {
        if (m != 1)
        {
            for (i = 0; i < n; i++)
            {
                laststu = laststu->next;
                master = master->next;
                if (i != n - 1)
                {
                    oldstu = oldstu->next;
                }
            }
            if (v == 1)
            {
                master2->id = laststu->next->id;
                v = 0;
            }
            else
            {
                nextstu2 = (struct member *)malloc(sizeof(struct member));
                nextstu2->id = laststu->next->id;
                laststu2->next = nextstu2;
                nextstu2->next = master2;
                laststu2 = laststu2->next;
            }

            //printf("%d ", laststu->next->id);

            free(laststu->next);
            laststu->next = master;
            laststu = oldstu;
        }
        else
        {

            nextstu2 = (struct member *)malloc(sizeof(struct member));
            nextstu2->id = master->id;
            laststu2->next = nextstu2;
            nextstu2->next = master2;

            //printf("%d ", master->id);
            free(master);
        }
        m -= 1;
    }

    oldstu2 = laststu2;
    m = m2;
    n = k;
    while (m != 0)
    {
        if (m != 1)
        {
            for (i = 0; i < n; i++)
            {
                laststu2 = laststu2->next;
                master2 = master2->next;
                if (i != n - 1)
                {
                    oldstu2 = oldstu2->next;
                }
            }
            printf("%4d", laststu2->next->id);

            free(laststu2->next);
            laststu2->next = master2;
            laststu2 = oldstu2;
        }
        else
        {
            printf("%4d", master2->id);
            free(master2);
        }
        m -= 1;
    }
    printf("\n");
    //system("pause");
    return 0;
}